package com.jlee.android.pimclient;

import android.content.Context;
import android.content.SharedPreferences;
import android.database.Cursor;
import android.util.Log;

public class PIMClientUtils {
	public static void dumpCursor(Cursor cursor) {
		Log.i(PIMClientConstant.TAG, "Dump Cursor Start>>>>>>>>>>>>>>>>>");
		if (cursor != null) {
			Log.i(PIMClientConstant.TAG, "Row Count: " + cursor.getCount());
			Log.i(PIMClientConstant.TAG, "Column Count: " + cursor.getColumnCount());
			while (cursor.moveToNext()) {
				Log.i(PIMClientConstant.TAG, ">>>>>>>>>>>----------<<<<<<<");
				for (int i = 0; i < cursor.getColumnCount(); i++) {
					Log.i(PIMClientConstant.TAG, "Name: " + cursor.getColumnName(i));
					Log.i(PIMClientConstant.TAG, "Value: " + cursor.getString(i));
				}
			}
		}
		Log.i(PIMClientConstant.TAG, "Dump Cursor End<<<<<<<<<<<<<<<<<<<");
	}
	
	public static void dumpSetting(Context context) {
		Log.i(PIMClientConstant.TAG, "Dump Setting Start>>>>>>>>>>>>>>>>>>");
		
		SharedPreferences settings = context.getSharedPreferences(
				PIMClientConstant.PREFS_NAME, Context.MODE_PRIVATE);
		
		Log.i(PIMClientConstant.TAG, "Company Name: " + 
				settings.getBoolean(PIMClientConstant.PREFS_KEY_CONTACT_COMPANYNAME, true));
		Log.i(PIMClientConstant.TAG, "Job Title: " + 
				settings.getBoolean(PIMClientConstant.PREFS_KEY_CONTACT_JOBTITLE, true));
		Log.i(PIMClientConstant.TAG, "Name: " + 
				settings.getBoolean(PIMClientConstant.PREFS_KEY_CONTACT_NAME, true));
		Log.i(PIMClientConstant.TAG, "Display Name: " + 
				settings.getBoolean(PIMClientConstant.PREFS_KEY_CONTACT_DISPLAYNAME, true));
		Log.i(PIMClientConstant.TAG, "Notes: " + 
				settings.getBoolean(PIMClientConstant.PREFS_KEY_CONTACT_NOTES, true));
		Log.i(PIMClientConstant.TAG, "IM: " + 
				settings.getBoolean(PIMClientConstant.PREFS_KEY_CONTACT_IM, true));
		Log.i(PIMClientConstant.TAG, "Personal Mail: " + 
				settings.getBoolean(PIMClientConstant.PREFS_KEY_CONTACT_PERSONALMAIL, true));
		Log.i(PIMClientConstant.TAG, "Business Mail: " + 
				settings.getBoolean(PIMClientConstant.PREFS_KEY_CONTACT_BUSINESSMAIL, true));
		Log.i(PIMClientConstant.TAG, "Mobile: " + 
				settings.getBoolean(PIMClientConstant.PREFS_KEY_CONTACT_MOBILE, true));
		Log.i(PIMClientConstant.TAG, "Home Phone: " + 
				settings.getBoolean(PIMClientConstant.PREFS_KEY_CONTACT_HOMEPHONE, true));
		Log.i(PIMClientConstant.TAG, "Work Phone: " + 
				settings.getBoolean(PIMClientConstant.PREFS_KEY_CONTACT_WORKPHONE, true));
		Log.i(PIMClientConstant.TAG, "Home Fax: " + 
				settings.getBoolean(PIMClientConstant.PREFS_KEY_CONTACT_HOMEFAX, true));
		Log.i(PIMClientConstant.TAG, "Work Fax: " + 
				settings.getBoolean(PIMClientConstant.PREFS_KEY_CONTACT_WORKFAX, true));
		Log.i(PIMClientConstant.TAG, "Picture: " + 
				settings.getBoolean(PIMClientConstant.PREFS_KEY_CONTACT_PICTURE, true));
		
		Log.i(PIMClientConstant.TAG, "Dump Setting End<<<<<<<<<<<<<<<<<<<<");
	}
}
